21. Configuration Changes

ANDK L4 42 Summary HS

DIY Rotate

QUIZ QUESTION::

Rotate your phone and record the callbacks triggered:

ANSWER CHOICES:



State

Method

Rotate phone state 1:

Rotate phone state 2:

Rotate phone state 3:

Rotate phone state 4:

Rotate phone state 5:

Rotate phone state 6:

SOLUTION:

State

Method

Rotate phone state 3:

Rotate phone state 5:

Rotate phone state 1:

Rotate phone state 4:

Rotate phone state 6:

Rotate phone state 2:

What's happening?

QUESTION:

Given what you just saw in the last exercise and what you've learned in this lesson, why do you think the data disappears?

ANSWER:

Thank you for your thoughts partner! Check out the video below for the final solution to the mystery.

L4 38 Rotation SC V1

onSaveInstanceState Recap

What happens to an activity if you override onSaveInstanceState and save some of your data, but don't call the super method?

SOLUTION: When the activity restarts after a configuration change, it could be missing some data, such as the edit text data.